package org.llc.bpmn.service;

import com.google.gson.Gson;
import org.llc.bpmn.model.po.LeaveApply;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
public class BpmLeave2Service {


    @Autowired
    BpmInstanceService bpmInstanceService;


    public void createBpm(String key, LeaveApply leaveApply) {
        String userId = "xiaomi";
        Map<String, Object> variables = new HashMap<>();
        variables.put("applyuserid", userId);
        variables.put("deptleader", leaveApply.getDeptleader());
        Gson gson = new Gson();
        String content = gson.toJson(leaveApply);
        bpmInstanceService.createBpmInstance(key, content, variables);
    }


}
